package cc.toprank.syncdatatask.config;

import com.toprank.druid.store.jdbc.Config;
import com.toprank.druid.store.jdbc.SqlTemplate;
import com.toprank.druid.store.jdbc.SqlTemplateFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * description 配置数据库
 * User: WeiDa
 * Date: 2017-5-7
 * Time: 12:00
 */
@Configuration
public class SqlTemplateConfig {

	@Bean
	public SqlTemplate getSqlTemplate(@Value("${jdbc.url}") String url, @Value("${jdbc.username}") String username, @Value("${jdbc.password}") String password) {
		Config config = new Config();
		config.setParameter("jdbc.url", url);
		config.setParameter("jdbc.username", username);
		config.setParameter("jdbc.password", password);
		config.setWorkThreads(10);
		config.setIdentity("client-sync");
		return SqlTemplateFactory.create(config);
	}


}
